<template>
  <div id="mallSearch" class="mall-search">
    <form name="searchTop" class="mallSearch-form clearfix">
      <fieldset>
        <legend>天猫搜索</legend>
        <div class="mallSearch-input clearfix">
          <div class="s-combobox" id="s-combobox-685">
            <div class="s-combobox-input-wrap">
              <input v-model="keyword" type="text" autocomplete="off" value="dd"
                     id="mq"
                     class="s-combobox-input" aria-haspopup="true">
            </div>
          </div>
          <button type="submit" @click.prevent="searchKey" id="searchbtn">搜索</button>
        </div>
      </fieldset>
    </form>
    <ul class="relKeyTop">
      <li><a>皮皮说Java</a></li>
      <li><a>皮皮说前端</a></li>
      <li><a>皮皮说Linux</a></li>
      <li><a>皮皮说大数据</a></li>
      <li><a>皮皮聊理财</a></li>
    </ul>
  </div>
</template>

<script>
import {mapActions} from 'vuex'

export default {
  name: "SearchB",
  data() {
    return {
      keyword: ''
    }
  },

  methods: {
    ...mapActions(['getBooks']),
    searchKey() {
      const {keyword, getBooks} = this
      if (keyword != null && keyword != '') {
        getBooks(keyword)
      }else {
        alert('请输入')
      }

    }

  }
}
</script>

<style scoped>

</style>
